package com.ruoyi.web.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.domain.Warehuose;
import com.ruoyi.web.service.IWarehuoseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/database/warehuose")
public class WarehuoseController extends BaseController {
    @Autowired
    private IWarehuoseService warehuoseService;

    /**
     * 查询【库房】列表
     */
    @PreAuthorize("@ss.hasPermi('database:warehuose:list')")
    @GetMapping("/list")
    public TableDataInfo list(Warehuose warehuose)
    {
        startPage();
        List<Warehuose> list = warehuoseService.selectWarehuoseList(warehuose);
        return getDataTable(list);
    }

    /**
     * 新增【库房】
     */
    @PreAuthorize("@ss.hasPermi('database:warehuose:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Warehuose warehuose)
    {
        return toAjax(warehuoseService.insertWarehuose(warehuose));
    }
}
